package com.giaothong.model;

import java.util.ArrayList;

import org.json.JSONObject;

import com.giaothong.config.Define;
import com.giaothong.model.entity.LocationStatus;
import com.giaothong.utils.ALog;
import com.giaothong.utils.JSONUtil;

public class ModelGetListLocationStatusRequest {

	private int code;
	private ArrayList<LocationStatus> locationStatus;

	/**
	 * setter & getter
	 */
	public void setCode(int code) {
		this.code = code;
	}

	public void setLocationStatus(ArrayList<LocationStatus> locationStatus) {
		this.locationStatus = locationStatus;
	}

	public int getCode() {
		return code;
	}

	public ArrayList<LocationStatus> getLocationStatus() {
		return locationStatus;
	}

	/**
	 * contructor
	 */

	public ModelGetListLocationStatusRequest() {
		setDefautValue();
	}

	public ModelGetListLocationStatusRequest(JSONObject jsonObject) {
		setDefautValue();
		if (jsonObject == null)
			return;
		this.code = JSONUtil.intTryGetValue(jsonObject, Define.CODE);
		ArrayList<JSONObject> data = JSONUtil.jsonArrayTryGetValue(jsonObject, Define.DATA);
		ALog.d("data", data.get(0) + "");
		for (int i = 0; i < data.size(); i++) {
			this.locationStatus.add(new LocationStatus(data.get(i)));
		}
	}
	private void setDefautValue() {
		this.code = 1;
		this.locationStatus = new ArrayList<LocationStatus>();
	}
}
